<?php

$ar = ' a="1" b="2" carlo="" s="caros"';


function parseArgument($args){

	$argl['args']=$args;

	preg_match_all("/(\S+)\s*=\s*(['\"])\s*(.*)\s*\g{2}/U",$args,$out, PREG_PATTERN_ORDER);
 
 
	if(isset($out[1])){
		foreach($out[1] as $key=> $var){
			$argl[$var]=(isset($out[3][$key])?$out[3][$key]:"");
		}
	}
	return $argl;
}
 echo "<pre>";
 
 print_r(parseArgument($ar));
?>